package com.WaVel.controller.admin;

import com.Emplyment.result.Result;
import com.Emplyment.vo.CompanyDataVo;
import com.Emplyment.vo.QuestionsDataVo;
import com.Emplyment.vo.UserDataVo;
import com.WaVel.service.DataService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@Slf4j
@RequestMapping("/data")
public class DataController {

    @Autowired
    private DataService dataService;

    @GetMapping("/company")
    public Result<List<CompanyDataVo>> getCompanyData() {
        List<CompanyDataVo> companyData = dataService.getCompanyData();
        log.info("getCompanyData: {}", companyData);
        return Result.success(companyData);
    }

    @GetMapping("/question")
    public Result<List<QuestionsDataVo>> getQuestionData() {
        List<QuestionsDataVo> questionData = dataService.getQustionData();
        log.info("getCompanyData: {}", questionData);
        return Result.success(questionData);
    }

    @GetMapping("/user")
    public Result<List<UserDataVo>> getUserData() {
        List<UserDataVo> userData = dataService.getUserData();
        log.info("getUserData: {}", userData);
        return Result.success(userData);
    }

}
